package com.roger.cmdkit.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class SysInputTest {

    public static void main(String[] arg) throws IOException {
        System.out.print("please input:");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String in =  br.readLine();
        System.out.println("system output: "+in);

        Scanner scan = new Scanner(System.in);
        double sum = 0;
        while (scan.hasNextDouble()) {
            double x = scan.nextDouble();
            sum = sum + x;
        }
        System.out.println("sum: "+sum);
        String s ="";
        while (scan.hasNextLine()) {
            if(scan.nextLine().equals("end")) break;
            s+=scan.nextLine();
        }
        System.out.println("line: "+s);
    }

}
